<?php
  function shownews($from,$count) {
    $connection=mysql_connect("127.0.0.1","avtovokzal","pipzemkam") or die("Ошибка соединения с сервером");
    $db=mysql_select_db("avtovokzal",$connection) or die("Ошибка при выборе базы данных");
    @mysql_query('set character_set_client="utf8"');
    @mysql_query('set character_set_results="utf8"');
    @mysql_query('set collation_connection="utf8_general_ci"');
    $result=mysql_query("SELECT * FROM `news` ORDER BY `datetime` DESC LIMIT ".$from.",".$count);
		while ($row=mysql_fetch_array($result,MYSQL_ASSOC)) {
      if ($row["status"]!='off') {
        echo '<div class="main_news_header"><i>'.substr($row["datetime"],8,2).'.'.substr($row["datetime"],5,2).'.'.substr($row["datetime"],0,4).'</i><b>'.$row["title"].'</b></div>';
        echo '<div class="main_news"><p>'.$row["fulltext"].'</p></div>';
      }  
	  }
		mysql_close($connection);
  }
  shownews(0,10);
?>